using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public class MainUIEntityData : IReusableClass
    {
        public uint MaxStore => 50;

        public int entityId { get; internal set; }
        public int entityMcid { get; internal set; }
        public int mapUIEntityCid { get; internal set; }
        public Vector3 position { get; internal set; }
        public Quaternion rotation { get; internal set; }
        public bool isOfferingQuest { get; internal set; }
        public bool isObstacleActive { get; internal set; }
        public bool isCheckPoint { get; internal set; }
        public bool isCheckPointActive { get; internal set; }

        public void OnReset()
        {
            entityId = 0;
            entityMcid = 0;
            mapUIEntityCid = 0;
            position = default;
            rotation = default;
            isOfferingQuest = false;
            isObstacleActive = false;
            isCheckPoint = false;
            isCheckPointActive = false;
        }
    }

    public class MapUIData : IReusableClass
    {
        public uint MaxStore => 1;

        public List<MainUIEntityData> entities { get; } = new();

        #region Pool
        public static MapUIData Create()
        {
            return ClassPool<MapUIData>.Get();
        }

        public static MainUIEntityData CreateEntityData()
        {
            return ClassPool<MainUIEntityData>.Get();
        }

        public void Put2Pool()
        {
            ClassPool.Put(this);
        }

        public void OnReset()
        {
            foreach (var data in entities)
            {
                ClassPool<MainUIEntityData>.Put(data);
            }

            entities.Clear();
        }
        #endregion
    }
}
